<?php 
namespace app\model;

use think\model;
use think\facade\Cache;

class WhModel extends Model 
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'warehouse';
    // 设置当前模型的数据库连接
    //protected $connection = 'db_config';
    //protected $pk = 'id';

    // 模型初始化
    protected static function init()
    {
        //TODO:初始化内容
    }


    public function getAll(){
        $list = Cache::get('wh');
        if(!$list){
            $list=[];
            $log = $this->order('id')->select()->toArray();
            foreach($log as $k=>&$v){
                $list[$v['id']]=$v;
            }
            Cache::set('wh',$list,300);
        }
        return $list;
    }
}

